//数组的冒泡排序
import java.util.Scanner;
import java.util.Arrays;

public class Array_sort {
    public static int[] sorted(int []arr1){
        //生成数组
        System.out.println("请输入元素：");
        for(int i=0;i<arr1.length;i++){
            int k = 0;
            Scanner sc1 = new Scanner(System.in);
            k = sc1.nextInt();
            arr1[i] = k;
        }
        //排序
        for(int j=0;j<arr1.length-1;j++){
            for(int i =0;i<arr1.length-1;i++) {
            int k = 0;
            if(arr1[i]>arr1[i+1]){
                k=arr1[i+1];
                arr1[i+1] = arr1[i];
                arr1[i] = k;
            }
        }
        }
        return arr1;
    }
    public static void main(String[] args){
        int [] arr = new int[5];
        arr = sorted(arr);
        System.out.println(Arrays.toString(arr));
    }
}
